package com.richinfo.buddy.oauthserver.model.security;

import com.google.code.kaptcha.Constants;
import org.springframework.security.web.authentication.WebAuthenticationDetails;

import javax.servlet.http.HttpServletRequest;

public class CustomWebAuthenticationDetails extends WebAuthenticationDetails {

    private static final long serialVersionUID = 3565937948822127274L;

    private String imageCode;

    private String sessionImageCode;

    public CustomWebAuthenticationDetails(HttpServletRequest request) {
        super(request);
        this.imageCode = request.getParameter("verifyCode");
        this.sessionImageCode = (String) request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
        //移除验证码
        request.getSession().removeAttribute(Constants.KAPTCHA_SESSION_KEY);
    }

    public String getImageCode() {
        return imageCode;
    }

    public String getSessionImageCode() {
        return sessionImageCode;
    }

}